<?php
/*------------------------------------------------------ */
//-- 钱包相关
//-- Author: iqgmy
/*------------------------------------------------------ */
namespace app\member\controller;
use app\ClientbaseController;
use app\mainadmin\model\SettingsModel;
use app\member\model\WithdrawModel;


class Wallet  extends ClientbaseController{
    /*------------------------------------------------------ */
    //-- 余额中心
    /*------------------------------------------------------ */
    public function balance(){
        $this->assign('title', '我的余额');
        $WithdrawModel = new WithdrawModel();
        $setcolor = new SettingsModel();
        $color = $setcolor->getRows();
		$this->assign('setcolor',$color['systemcolor']); 

        $where = [];
        $where[] = ['status','=',0];
        $where[] = ['user_id','=',$this->userInfo['user_id']];
        $cash_now = 0;
        $cash_now = $WithdrawModel->where($where)->sum('amount');

        $where = [];
        $where[] = ['status','=',9];
        $where[] = ['user_id','=',$this->userInfo['user_id']];
        $cash_yes = 0;
        $cash_yes = $WithdrawModel->where($where)->sum('amount');
        $this->assign('cash_now', $cash_now);
        $this->assign('cash_yes', $cash_yes);
        return $this->fetch('balance');
    }
	/*------------------------------------------------------ */
	//-- 我的佣金
	/*------------------------------------------------------ */
	public function index(){
        $setcolor = new SettingsModel();
        $color = $setcolor->getRows();
		$this->assign('setcolor',$color['systemcolor']); 

        $this->assign('title', '我的佣金');
		return $this->fetch('index');
	}
    /*------------------------------------------------------ */
    //-- 我的星券
    /*------------------------------------------------------ */
    public function jifen(){
        $setcolor = new SettingsModel();
        $color = $setcolor->getRows();
		$this->assign('setcolor',$color['systemcolor']); 

        $this->assign('title', '我的星券');
        return $this->fetch('jifen');
    }
	/*------------------------------------------------------ */
    //-- 充值
    /*------------------------------------------------------ */
    public function recharge(){
        $setcolor = new SettingsModel();
        $color = $setcolor->getRows();
		$this->assign('setcolor',$color['systemcolor']); 
        $order_id = input('order_id',0,'intval');
        $account['weixinpay'] = settings('weixinpay');
        $account['alipay'] = settings('alipay');
        $account['bank_name'] = settings('bank_name');
        $account['bank_card'] = settings('bank_card');
        $account['full_name'] = settings('full_name');

        $this->assign('title', '充值');
        $this->assign('account', $account);
        return $this->fetch('recharge');
    }
	/*------------------------------------------------------ */
    //-- 余额明细
    /*------------------------------------------------------ */
    public function mylog(){
        $setcolor = new SettingsModel();
        $color = $setcolor->getRows();
		$this->assign('setcolor',$color['systemcolor']); 
        $this->assign('title', '余额明细');
        return $this->fetch('mylog');
    }
    /*------------------------------------------------------ */
    //-- 待返广告费明细
    /*------------------------------------------------------ */
    public function bmylog(){
        $setcolor = new SettingsModel();
        $color = $setcolor->getRows();
		$this->assign('setcolor',$color['systemcolor']); 
        $this->assign('title', '待返广告费明细');
        return $this->fetch('bmylog');
    }
    /*------------------------------------------------------ */
    //-- 星券明细
    /*------------------------------------------------------ */
    public function jfmylog(){
        $setcolor = new SettingsModel();
        $color = $setcolor->getRows();
		$this->assign('setcolor',$color['systemcolor']); 

        $this->assign('title', '星券明细');
        return $this->fetch('jfmylog');
    }
    /*------------------------------------------------------ */
    //-- 星券明细
    /*------------------------------------------------------ */
    public function dbmylog(){
        $setcolor = new SettingsModel();
        $color = $setcolor->getRows();
		$this->assign('setcolor',$color['systemcolor']); 

        $this->assign('title', '待返星券明细');
        return $this->fetch('dbmylog');
    }
    /*------------------------------------------------------ */
    //-- 佣金明细
    /*------------------------------------------------------ */
    public function dividendLog(){
        $setcolor = new SettingsModel();
        $color = $setcolor->getRows();
		$this->assign('setcolor',$color['systemcolor']); 
        $this->assign('title', '佣金明细');
        return $this->fetch('dividend_log');
    }


    /*------------------------------------------------------ */
    //-- 排行榜
    /*------------------------------------------------------ */
    public function leaderboard(){
        $this->assign('title', '排行榜');
        return $this->fetch('leaderboard');
    }


}?>